|
|
|
|
|
|
|
On the other hand, the UserDocument supports the following events that the form doesn't support: |
|
|
|
|
|
|
|
|
AsycReadComplete-Occurs when the container holding the document has finished an asynchronous read request. |
|
|
|
|
|
|
|
|
EnterFocus-Occurs when the ActiveX document receives focus. |
|
|
|
|
|
|
|
|
ExitFocus-Occurs when the ActiveX document loses focus. |
|
|
|
|
|
|
|
|
Hide-Occurs when the user navigates from the current ActiveX document to another document. |
|
|
|
|
|
|
|
|
InitProperties-Occurs when the document is first loaded. However, if any properties have been saved using the PropertyBag, the ReadProperties event will occur instead. |
|
|
|
|
|
|
|
|
ReadProperties-Occurs in place of the InitProperties event if items are stored in a PropertyBag. This event also occurs as the document is first loaded. |
|
|
|
|
|
|
|
|
Scroll-Occurs when the user uses the scrollbar of the container in which the ActiveX document is running. |
|
|
|
|
|
|
|
|
Show-Occurs when the user navigates from another document to the ActiveX document. |
|
|
|
|
|
|
|
|
WriteProperties-Occurs as the program is about to be terminated. This event happens right before the Terminate event, but only occurs if the PropertyChanged statement has been used to indicate that a change in a property's value has occurred. |
|
|
|
|
|
|
|
|
Using Properties for a UserDocument |
|
|
|
|
|
|
|
|
Because a UserDocument is a stand-alone object, if you are creating an application that uses more than one form, you need to use properties the way a user control does. All three objectsform, UserControl, and UserDocumentenable you to create properties and methods to extend their capabilities. However, only the UserControl and the UserDocument have the capability to use the PropertyBag object, which along with some special events, is used to store values of public properties so that settings are remembered between sessions, and enable you to pass parameters between ActiveX documents. |
|
|
|
|
|
|
|
|
To see how this works, add a text box and a command button to the UserDocument as shown in Figure 21.6. |
|
|
|
|
|